package com.liangfeng.breezebrowser.base;

import android.app.Application;
import android.content.Context;

import com.zhy.http.okhttp.OkHttpUtils;

import org.greenrobot.eventbus.EventBus;

import java.util.concurrent.TimeUnit;

import io.realm.Realm;
import io.realm.RealmConfiguration;
import okhttp3.OkHttpClient;

/**
 * Created by mozhifeng on 2017/5/25.
 */

public class BrowserApplication extends Application {

    public static Context context;
    public static Realm realm;

    @Override
    public void onCreate() {
        super.onCreate();

        context = getApplicationContext();
        //初始化数据库
        Realm.init(context);
        RealmConfiguration config = new RealmConfiguration.Builder()
                .name("myrealm.realm") //文件名
                .schemaVersion(1) //版本号
                .build();
        realm = Realm.getDefaultInstance();

        OkHttpClient okHttpClient = new OkHttpClient.Builder()
//                .addInterceptor(new LoggerInterceptor("TAG"))
                .connectTimeout(10000L, TimeUnit.MILLISECONDS)
                .readTimeout(10000L, TimeUnit.MILLISECONDS)
                //其他配置
                .build();

        OkHttpUtils.initClient(okHttpClient);
    }


}
